package com.excetop.xservlet.req.param;

/**
 * boolean 参数
 * @author xuZW
 *
 */
public class BooleanParam extends TextParam {

	/**
	 * boolean 参数值
	 */
	private boolean booleanValue;
	
	/**
	 * boolean 参数值数组
	 */
	private boolean[] booleanValueArray;

	public BooleanParam() {
	}
	
	public BooleanParam(String name, String[] textValueArray) {
		this(name, textValueArray, null);
	}
	
	public BooleanParam(String name, String[] textValueArray, String[] patternArray) {
		super(name, textValueArray, patternArray);
		setType(TYPE_BOOLEAN);
		String[] values = getTextValueArrayWithoutSpaceCharacter();
		if(null != values && values.length > 0){
			booleanValueArray = new boolean[values.length];
			for (int i = 0; i < booleanValueArray.length; i++) {
				try { booleanValueArray[i] = Boolean.valueOf(values[i]); }
				catch (Exception e) {}
			}
		}
		String value = getTextValueWithoutSpaceCharacter();
		if(null != value){
			try { booleanValue = Boolean.valueOf(value); }
			catch (Exception e) {}
		}
	}
	
	public boolean isBooleanValue() {
		return booleanValue;
	}
	
	public boolean getBooleanValue() {
		return booleanValue;
	}

	public void setBooleanValue(boolean booleanValue) {
		this.booleanValue = booleanValue;
	}

	public boolean[] getBooleanValueArray() {
		return booleanValueArray;
	}

	public void setBooleanValueArray(boolean[] booleanValueArray) {
		this.booleanValueArray = booleanValueArray;
	}

	@Override
	public boolean verifying() {
		boolean result = true;
		// TODO Auto-generated method stub
		return result;
	}
	
}
